package tech.aistar.mapper.authordis;

import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tech.aistar.entity.authordis.NoteAuthor;
import tech.aistar.entity.authordis.Notes;

import java.util.List;

/**
 * Created by lenovo on 2019/10/11.
 */
public interface ITravelerInfoDisMapper {

    /**
     * 通过游记作者id查询其游记
     * @param id
     * @return
     */
    @Select("select * from notes where autuor_id=#{value} and obtain=0")
    List<Notes> findNotesByAuthorId(Integer id);

    /**
     * 通过用户id查询其游记作者
     * @return
     */
    @Select("select * from note_author where user_id = #{value}")
    NoteAuthor findAuthorByUserId(Integer id);

    /**
     * 根据游记id进行下架更新操作
     * @param id
     */
    @Select("update notes set obtain = 1 where id = #{value}")
    void updateNoteById(Integer id);

}
